﻿using TaskManager.Domain.BusinessObjects;
using TaskManager.Domain.Repositories;

namespace TaskManager.DataAccess.Repositories
{
    /// <summary>
    /// Project log writer
    /// </summary>
    internal class ProjectLogWriter : Repository<ProjectLogEntry, int>, IProjectLogWriter
    {
        private static readonly log4net.ILog Log = log4net.LogManager.GetLogger(typeof(ProjectLogWriter));

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="context">Database context</param>
        public ProjectLogWriter(TaskManagerDbContext context)
            : base(context, context.ProjectLogs)
        {
            if (Log.IsDebugEnabled) Log.Debug("Created ProjectLogWriter");
        }

        /// <summary>
        /// Writes new message
        /// </summary>
        /// <param name="entry">Log entry</param>
        public void Write(ProjectLogEntry entry)
        {
            Insert(entry);
        }
    }
}